import { getNewsByIdAPI } from '../../api/news';
import { NEWS_SAVE_LIST } from './actionType';

export const getNewsByIdAction = (id) => {
  return async (dispatch) => {
    const res = await getNewsByIdAPI(id);
    console.log('res  ----->  ', res);

    // 3. dispatch触发action保存
    dispatch({
      type: NEWS_SAVE_LIST,
      payload: res.data.results,
    });
    // 4. 取出数据，渲染界面
  };
};
